package Test.MQ.ACK;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MessageSender {

    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void sendToAutoAckQueue(String message) {
        rabbitTemplate.convertAndSend(RabbitMQConfig.AUTO_ACK_QUEUE, message);
        System.out.println("发送消息到自动ACK队列: " + message);
    }

    public void sendToManualAckQueue(String message) {
        rabbitTemplate.convertAndSend(RabbitMQConfig.MANUAL_ACK_QUEUE, message);
        System.out.println("发送消息到手动ACK队列: " + message);
    }
}